package com.itheima.myDUOTAI.test02;

public class Test {
    /*public static void main(String[] args) {
        Animal animal = new Dog();
        Cat cat = (Cat)animal;
    }
    ClassCastException */

    /*public static void main(String[] args) {
        Animal animal = new Dog();
        Dog dog = (Dog)animal;
    }*/

    /*public static void main(String[] args) {
        Animal animal = new Dog();
        Wolf wolf = (Wolf)animal;
    }
    ClassCastException */

    /*public static void main(String[] args) {
        Animal animal = new Cat();
        Cat cat = (Cat)animal;
    }*/
}

 abstract class Animal {
    public abstract void speek();
}
 class Dog extends Animal {
    public void speek() {
        System.out.println("汪汪汪...");
    }
}
 class Cat extends Animal {
    public void speek() {
        System.out.println("喵喵喵...");
    }
}
 class Wolf extends Animal {
    public void speek() {
        System.out.println("嗷嗷嗷...");
    }
}